// components/tanchuang/tanchuang.js
Component({
// 样式相互影响
  // options:{
  //   styleIsolation:"apply-shared"
  // },
  /**
   *
   * 组件的属性列表
   *
   * /
  properties: {

  },
  
  /**
   * 组件的初始数据
   */
  //传送类名
  externalClasses:['content'],
 
    
  
  data: {
    piece:0,
    xingji: [
          { id: 0, name: '不限',     select: false}, 
          { id: 1, name: '二星/经济', select: false}, 
          { id: 2, name: '三星/舒适', select: false}, 
          { id: 3, name: '四星/高档', select: false} ,
          { id: 4, name: '五星/豪华', select: false}
      ],
    
  },

  /**
   * 组件的方法列表
   */
  methods: {
    huadong(e){
      let value=e.detail.value;
      this.setData({
        piece: value
      })
    },
    show(e){
      
      let item=e.currentTarget.dataset.item;
      
      let isSelect=!item.select;
      let arr=this.data.xingji;
      let newArr=[];
      arr.forEach(element => {
        
        if (element.id === item.id) {
          
          element.select = isSelect;
        };
        
        newArr.push(element)
      });
      
      this.setData({
        xingji: newArr
      })
    }
  }
})
